﻿using Autofac;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace VIP.Domain.BusServices
{
    public class BusinessAutofacModuleRegister : Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {

            // 服务项目程序集
            Assembly service = Assembly.Load("VIP.Domain");
            // 服务接口项目程序集
            Assembly iservice = Assembly.Load("VIP.Domain");
            builder.RegisterAssemblyTypes(service, iservice)
            .Where(t => t.FullName.EndsWith("Service") && !t.IsAbstract)
            .InstancePerLifetimeScope()
            .AsImplementedInterfaces()
            .PropertiesAutowired();
        }
    }
}
